package ru.reinvent.perspectiva.cash;

import org.joda.time.DateTime;
import org.joda.time.DateTimeZone;
import org.joda.time.format.DateTimeFormat;
import org.joda.time.format.DateTimeFormatter;

import android.graphics.Bitmap;
import android.graphics.BitmapFactory;

public class Lot 
	{
	private int id = -1;
	private int vendorId = -1;
	private String link = null;
	private String name = null;
	private DateTime addDate = null;
	private String price = null;
	private String reference = null;
	private Bitmap image = null;
	private String imageUrl = null;
	private String imageCashUri = null;
	private String hull = null;
	private String gender = null;
	private String type = null;
	private String desc = null;
	private String state = null;
	private String region = null;
	
	public int getId() { return id; }
	public int getVendorId() { return vendorId; }
	public String getName() { return name; }
	public String getLink() { return link; }
	public DateTime getAddDate() { return addDate; }
	public String getPrice() { return price; }
	public String getReference() { return reference; }
	public Bitmap getImage() { return image; }
	public String getImageUrl() { return imageUrl; }
	public String getImageCashUri() { return imageCashUri; }
	public String getHull() { return hull; }
	public String getGender() { return gender; }
	public String getType() { return type; }
	public String getDescription() { return desc; }
	public String getState() { return state; }
	public String getRegion() { return region; }
	
	public void setId(int id) { this.id = id; }
	public void setVendorId(int vendorId) { this.vendorId = vendorId; }
	public void setName(String name) { this.name = name; }
	public void setLink(String link) { this.link = link; }
	public void setAddDate(DateTime addDate) { this.addDate = addDate; }
	public void setAddDate(int day, int month, int year) { this.addDate = new DateTime(year,month,day,0,0); }
	public void setPrice(String price) { this.price = price; }
	public void setReference(String reference) { this.reference = reference; }
	public void setImage(Bitmap image) { this.image = image; }
	public void setImageUrl(String imageUrl) { this.imageUrl = imageUrl; }
	public void setHull(String hull) { this.hull = hull; }
	public void setGender(String gender) { this.gender = gender; }
	public void setType(String type) { this.type = type; }
	public void setDescription(String desc) { this.desc = desc; }
	public void setState(String state) { this.state = state; }
	public void setRegion(String region) { this.region = region; }

	public void setImageCashUri(String imageCashUri) 
		{ 
		this.imageCashUri = imageCashUri;
		
		try { if (image == null) image = BitmapFactory.decodeFile(imageCashUri); }
		catch(Exception e) {;}
		}
	
	public void setAddDate(String ruRuDate) 
		{
		DateTimeFormatter formatter = DateTimeFormat.forPattern("dd.MM.yyyy");
		this.addDate = formatter.parseDateTime(ruRuDate); 
		}
	
	public void setAddDate(long ruRuTimestamp) 
		{
		this.addDate = new DateTime(ruRuTimestamp,DateTimeZone.forID("Europe/Moscow")); 
		}
	}
